﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfAsteriskCTI
{
    /// <summary>
    /// Interaction logic for dlgAddGlobalPhonebookEntry.xaml
    /// </summary>
    public partial class dlgAddGlobalPhonebookEntry : Window
    {
        public string[] Input { get; set; }

        public dlgAddGlobalPhonebookEntry(string sCustomerName, string sCompany, string sPhone1, string sPhone2, string sMobile)
        {
            InitializeComponent();
            txtCustomerName.Text = sCustomerName;
            txtCompany.Text = sCompany;
            txtPhone1.Text = sPhone1;
            txtPhone2.Text = sPhone2;
            txtMobile.Text = sMobile;

        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
            this.Close();
        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtPhone1.Text))
            {
                Input = new String[6];
                Input[0] = txtCustomerName.Text;
                Input[1] = txtCompany.Text;
                Input[2] = txtPhone1.Text;
                Input[3] = txtPhone2.Text;
                Input[4] = txtMobile.Text;
                DialogResult = true;
            }
            else
            {
                MessageBox.Show("Phone 1 is a required field!");
            }
        }
    }
}
